package com.springcloud.demo.service;

import com.springcloud.demo.pojo.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;

/**
 * @Author: XiaoJie Wang
 * @Description:
 * @Date: Create in 9:48 2021/7/16
 */
@Service
public class OrderServiceImpl implements OrderService{

    @Autowired
    private ProductService productService;

    @Override
    public Order selectOrderById(Integer id) {
        return new Order(id, "order-feign", "中国", 22788D,
                productService.selectProductList());
    }

    /**
     * 根据主键查询订单
     *
     * @param id
     * @return
     */
    @Override
    public Order getOrderById(Integer id) {
        return new Order(id, "order-get", "中国", 2666D,
                Arrays.asList(productService.selectProductById(5)));
    }
}
